Slider
| Kind of class: | class |
|---|---|
| Inherits from: | UIComponent < MovieClip |
| Classpath: | gfx.controls.Slider |
| File last modified: | Tuesday, 29 June 2010, 09:03:27 |
The Slider displays a numerical value in range, with a thumb to represent the value, as well as modify it via dragging.
Inspectable Properties
The inspectable properties of the Slider component:
Like the ScrollIndicator and the ScrollBar, the Slider does not have explicit states. It uses the states of its child elements, the thumb and track Button components.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
Inspectable Properties
The inspectable properties of the Slider component:
- visible: Hides the component if set to false.
- disabled: Disables the component if set to true.
- value: The numeric value displayed by the Slider.
- minimum: The minimum value of the Slider’s range.
- maximum: The maximum value of the Slider’s range.
- snapping: If set to true, then the thumb will snap to values that are multiples of snapInterval.
- snapInterval: The snapping interval which determines which multiples of values the thumb snaps to. It has no effect if snapping is set to false.
- liveDragging: If set to true, then the Slider will generate a change event when dragging the thumb. If false, then the Slider will only generate a change event after the dragging is over.
- offsetLeft: Left offset for the thumb. A positive value will push the thumb inward.
- offsetRight: Right offset for the thumb. A positive value will push the thumb inward.
- enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
- soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
Like the ScrollIndicator and the ScrollBar, the Slider does not have explicit states. It uses the states of its child elements, the thumb and track Button components.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
- type: The event type.
- target: The target that generated the event.
- show: The component’s visible property has been set to true at runtime.
- hide: The component’s visible property has been set to false at runtime.
- focusIn: The component has received focus.
- focusOut: The component has lost focus.
- change: The Slider value has changed.
Component metadata:
| InspectableList | "disabled" "enableInitCallback" "liveDragging" "maximum" "minimum" "offsetLeft" "offsetRight" "snapInterval" "snapping" "soundMap" "value" "visible" |
|---|
Summary
Constructor
Instance properties
- liveDragging
- Determines if the Slider dispatches "change" events while dragging the thumb, or only after dragging is complete.
- state
- The mouse state of the button.
- soundMap
- Mapping between events and sound process
- thumb
- A reference to the thumb symbol in the Slider, used to display the slider value, and change the value via dragging.
- track
- A reference to the track symbol in the Slider used to display the slider range, but also to jump to a specific value via clicking.
- maximum
- The maximum number the value can be set to.
- minimum
- The minimum number the value can be set to.
- value
- The value of the slider between the minimum and maximum.
- disabled
- Disable this component.
- position
- The value of the Slider, to make it polymorphic with a ScrollIndicator.
- snapping
- Whether or not the value "snaps" to a rounded value.
- snapInterval
- The interval to snap to when snapping is true.
Instance properties inherited from UIComponent
__height __width _disabled _displayFocus _focused addEventListener cleanUpEvents disabled dispatchEvent displayFocus enableInitCallback focused focusHandlerReference focusTarget hasEventListener height initialized invalidationIntervalID removeAllEventListeners removeEventListener sizeIsInvalid soundMap visible width
Class methods
Class methods inherited from UIComponent
Instance methods
- handleInput
- Handle input from the game, via controllers or keyboard.Instance methods inherited from UIComponent
Constructor
Slider
function Slider (
)
The constructor is called when a Slider or a sub-class of Slider is instantiated on stage or by using
attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend Slider, ensure that a super() call is made first in the constructor. Instance properties
disabled
disabled:Boolean
(read,write)
Disable this component. Focus (along with keyboard events) and mouse events will be suppressed if disabled.
liveDragging
liveDragging:Boolean = false
(read,write)
Determines if the Slider dispatches "change" events while dragging the thumb, or only after dragging is complete.
maximum
maximum:Number
(read,write)
The maximum number the
value can be set to. minimum
minimum:Number
(read,write)
The minimum number the
value can be set to. position
position:Number
(read,write)
snapInterval
snapInterval:Number
(read,write)
The interval to snap to when
snapping is true. See also:
snapping
snapping:Boolean
(read,write)
Whether or not the
value "snaps" to a rounded value. When snapping is true, the value can only be set to multiples of the snapInterval. See also:
soundMap
soundMap:Object = { theme:"default", focusIn:"focusIn", focusOut:"focusOut", change:"change" }
(read,write)
Mapping between events and sound process
state
state:String = "default"
(read,write)
The mouse state of the button. Mouse states can be "default", "disabled".
thumb
A reference to the thumb symbol in the Slider, used to display the slider
value, and change the value via dragging. track
A reference to the track symbol in the Slider used to display the slider range, but also to jump to a specific value via clicking.
Instance methods
handleInput
Handle input from the game, via controllers or keyboard. The default handleInput will handle standalone and composite components.
Parameters:
details :
An
InputDetails object containing details from the interaction.pathToFocus:
A list of children in the focus path that are below this component. Components are responsible for calling
handleInput() on the next component in the pathToFocus unless they choose to intercept the call.Overrides: